﻿using ExtBusiness.FlowOperation;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Office_SmcgDwInfo : System.Web.UI.Page
{
    public string strHtml = "请先选图。。。";
    public string strGyxx = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            strHtml = "";
            RequestFlowOperation rfoTemp = new RequestFlowOperation();
            DataTable dtSourceGyxx = rfoTemp.GetSmcgGYXX(Request["IID"]);
            if (dtSourceGyxx.Rows.Count > 0) {
                strHtml += "<h2 style='background-color:##F8F8F8;'>概要信息</h2>";
                //strGyxx = dtSourceGyxx.Rows[0]["ddgyxx"].ToString();
                strGyxx = dtSourceGyxx.Rows[0]["ddgyxx"].ToString().Replace("):", " ):<br />&nbsp;&nbsp;&nbsp;&nbsp;");
                strGyxx = strGyxx.Replace("水准点", " <br />&nbsp;&nbsp;水准点");
                strGyxx = strGyxx.Replace("三角点", " <br />&nbsp;&nbsp;三角点");
                strGyxx = strGyxx.Replace("GNSS成果", " <br />&nbsp;&nbsp;GNSS成果");
                strGyxx = strGyxx.Replace("航空影像", " <br />&nbsp;&nbsp;航空影像");
                strGyxx = strGyxx.Replace("矢量地图数据", " <br />&nbsp;&nbsp;矢量地图数据");
                //strGyxx = strGyxx.Replace("DEM", " <br />&nbsp;&nbsp;DEM");
                strGyxx = strGyxx.Replace("分幅正射影像数据", " <br />&nbsp;&nbsp;分幅正射影像数据");
                strGyxx = strGyxx.Replace("模拟地形图", " <br />&nbsp;&nbsp;模拟地形图");
                strGyxx = strGyxx.Replace("1:", " <br />&nbsp;&nbsp;1:");
                strGyxx += "<br /><br />";
                //int a = strGyxx.Length;
                //strGyxx = strGyxx.Substring(6, 30); 
                strHtml += " <p style='background-color:white;font-size:16px'>" + strGyxx + "</p>";
                strHtml += "<h2 style='background-color:##F8F8F8'>订单明细</h2>";
            }
                 
            DataTable dtSource = rfoTemp.GetSmcgAppInfo(Request["IID"],"水准点");
                        
            if (dtSource.Rows.Count > 0 )
            {
                strHtml += "<tr> <font size ='3' face='宋体'>成果类型：水准点</font></tr>";
                strHtml += "<table style='width:100%' class='tab'>";
                strHtml += "<tr><td style='width:20%'>点名</td><td style='width:25%'>网名</td><td style='width:10%'>等级</td><td style='width:15%'>生产时间</td><td style='width:25%'>高程基准</td><td style='width:5%'>密级</td></tr>";

                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    DataRow drTemp = dtSource.Rows[i];
                    strHtml += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>", drTemp["Dataname"], drTemp["rsname"], drTemp["version"], drTemp["ENTERDATE"], drTemp["GCJZ"], drTemp["SECRETS"]);
                }
                strHtml += "</table>";
            }

            dtSource = rfoTemp.GetSmcgAppInfo(Request["IID"], "三角点");

            if (dtSource.Rows.Count > 0)
            {
                strHtml += "<tr> <font size ='3' face='宋体'>成果类型：三角点</font></tr>";
                strHtml += "<table style='width:100%' class='tab'>";
                strHtml += "<tr><td style='width:20%'>点名</td><td style='width:25%'>网名</td><td style='width:10%'>等级</td><td style='width:15%'>生产日期</td><td style='width:25%'>大地基准</td><td style='width:5%'>密级</td></tr>";

                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    DataRow drTemp = dtSource.Rows[i];
                    strHtml += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr> ", drTemp["Dataname"], drTemp["rsname"], drTemp["version"], drTemp["ENTERDATE"], drTemp["DDJZ"], drTemp["SECRETS"]);
                }
                strHtml += "</table>";
            }

            dtSource = rfoTemp.GetSmcgAppInfo(Request["IID"], "GNSS成果");

            if (dtSource.Rows.Count > 0)
            {
                strHtml += "<tr> <font size ='3' face='宋体'>成果类型：GNSS成果</font></tr>";
                strHtml += "<table style='width:100%' class='tab'>";
                strHtml += "<tr><td style='width:20%'>点名</td><td style='width:25%'>网名</td><td style='width:10%'>等级</td><td style='width:15%'>生产时间</td><td style='width:25%'>大地基准</td><td style='width:5%'>密级</td></tr>";

                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    DataRow drTemp = dtSource.Rows[i];
                    strHtml += string.Format(" <tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>", drTemp["Dataname"], drTemp["rsname"], drTemp["version"], drTemp["ENTERDATE"], drTemp["DDJZ"], drTemp["SECRETS"]);
                }
                strHtml += "</table>";
            }

            dtSource = rfoTemp.GetSmcgAppInfo(Request["IID"], "航空影像");

            if (dtSource.Rows.Count > 0)
            {
                strHtml += "<tr> <font size ='3' face='宋体'>成果类型：航空影像</font></tr>";
                strHtml += "<table style='width:100%' class='tab'>";
                strHtml += "<tr><td>摄区名称</td><td>最小航摄比例尺</td><td>分辨率</td><td>航摄仪</td><td>航摄年份</td><td>密级</td></tr>";

                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    DataRow drTemp = dtSource.Rows[i];
                    strHtml += string.Format(" <tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>", drTemp["DATANAME"], drTemp["SCALE"], drTemp["scale"], drTemp["yxsjy"], drTemp["IMAGEDATE"], drTemp["SECRETS"]);
                }
                strHtml += "</table>";
            }
            dtSource = rfoTemp.GetSmcgAppInfo(Request["IID"], "矢量地图数据");

            if (dtSource.Rows.Count > 0)
            {
                strHtml += "<tr> <font size ='3' face='宋体'>成果类型：矢量地图数据</font></tr>";
                strHtml += "<table style='width:100%' class='tab'>";
                strHtml += "<tr><td>成果单元名称</td><td>图号</td><td>比例尺</td><td>大地基准</td><td>高程基准</td><td>出版时间</td><td>密级</td></tr>";

                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    DataRow drTemp = dtSource.Rows[i];
                    strHtml += string.Format(" <tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>", drTemp["rsname"], drTemp["NEWMAPNO"], drTemp["SCALE"], drTemp["DDJZ"], drTemp["GCJZ"], drTemp["ENTERDATE"], drTemp["SECRETS"]);
                }
                strHtml += "</table>";
            }
            dtSource = rfoTemp.GetSmcgAppInfo(Request["IID"], "DEM");

            if (dtSource.Rows.Count > 0)
            {
                strHtml += "<tr> <font size ='3' face='宋体'>成果类型：DEM</font></tr>";
                strHtml += "<table style='width:100%' class='tab'>";
                strHtml += "<tr><td>新图号</td><td>格网间距</td><td>比例尺</td><td>大地基准</td><td>高程基准</td><td>生产时间</td><td>密级</td></tr>";

                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    DataRow drTemp = dtSource.Rows[i];
                    strHtml += string.Format(" <tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>", drTemp["NEWMAPNO"], drTemp["RESOLUTION"], drTemp["SCALE"], drTemp["DDJZ"], drTemp["GCJZ"], drTemp["ENTERDATE"], drTemp["SECRETS"]);
                }
                strHtml += "</table>";
            }
            dtSource = rfoTemp.GetSmcgAppInfo(Request["IID"], "分幅正射影像数据");

            if (dtSource.Rows.Count > 0)
            {
                strHtml += "<tr> <font size ='3' face='宋体'>成果类型：分幅正射影像数据</font></tr>";
                strHtml += "<table style='width:100%' class='tab'>";
                strHtml += "<tr><td>图号</td><td>比例尺</td><td>分辨率</td><td>影像时间</td><td>大地基准</td><td>高程基准</td><td>密级</td></tr>";

                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    DataRow drTemp = dtSource.Rows[i];
                    strHtml += string.Format(" <tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td></tr>", drTemp["NEWMAPNO"], drTemp["SCALE"], drTemp["RESOLUTION"], drTemp["IMAGEDATE"], drTemp["DDJZ"], drTemp["GCJZ"], drTemp["SECRETS"]);
                }
                strHtml += "</table>";
            }
            dtSource = rfoTemp.GetSmcgAppInfo(Request["IID"], "模拟地形图");

            if (dtSource.Rows.Count > 0)
            {
                strHtml += "<tr> <font size ='3' face='宋体'>成果类型：模拟地形图</font></tr>";
                strHtml += "<table style='width:100%' class='tab'>";
                strHtml += "<tr><td style='width:20%'>成果单元名称</td><td style='width:20%'>新图号</td><td style='width:20%'>大地基准</td><td style='width:20%'>高程基准</td><td style='width:15%'>出版时间</td><td style='width:5%'>密级</td></tr>";

                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    DataRow drTemp = dtSource.Rows[i];
                    strHtml += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>",  drTemp["rsname"], drTemp["NEWMAPNO"], drTemp["DDJZ"], drTemp["GCJZ"], drTemp["ENTERDATE"], drTemp["SECRETS"]);
                }
                strHtml += "</table>";
            }

            if (strHtml =="") {
                strHtml = "请先选图。。。";
            }
                if (Request["act"] == "Print" || Request["act"] == "PrintView")
            {
                strHtml += "<script>window.print();</script>";
            }
        }
    }

}